package com.ywwl.controller;

import com.alibaba.fastjson.JSON;
import com.ywwl.domain.table.SysRole;
import com.ywwl.service.RoleService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/role")
public class RoleController {
    private static Logger logger = Logger.getLogger(RoleController.class);

    @Resource
    private RoleService roleService;

    @ResponseBody
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public List<SysRole> find() throws Exception {

        List<SysRole> list = this.roleService.list();

        logger.info("用户信息：" + JSON.toJSONString(list));
        return list;
    }
}
